FROM node:16.18.0-alpine3.16 AS download_deps
WORKDIR /download
COPY package.json yarn.lock ./
RUN yarn

FROM node:16.18.0-alpine3.16 AS build
WORKDIR /build
COPY . /build/
COPY --from=download_deps /download/node_modules /build/node_modules/
RUN yarn run build

FROM nginx:stable-alpine
ENV TZ="Asia/Shanghai"
COPY docker/nginx-settings/conf.d/*.conf /etc/nginx/conf.d/
COPY --from=build /build/dist /www

## Example of using this Dockerfile:
##
## docker build -t my_vue_app:latest .
## docker run -itd --rm -p "8080:80" my_vue_app:latest
